# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=homer-app
pkgver=1.2.0
_uiver=7.8.0
pkgrel=0
pkgdesc="HOMER 7.x Front-End and API Server"
url="http://sipcapture.io"
arch="x86_64"
license="AGPL-3.0-or-later"
makedepends="go"
install="$pkgname.pre-install"
options="!check" # no test suite
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/sipcapture/homer-app/archive/$pkgver.tar.gz
	https://github.com/sipcapture/homer-app/releases/download/$pkgver/homer-ui-$_uiver.tgz
	$pkgname.initd
	change-default-locations.patch
	"

build() {
	make modules
	make all
}

check() {
	"release/homer-app_linux_amd64/homer-app" --version
}

package() {
	install -D -m755 release/homer-app_linux_amd64/homer-app "$pkgdir"/usr/bin/homer-app
	install -D -m644 etc/webapp_config.json "$pkgdir"/etc/homer/webapp_config.json
	mkdir -p "$pkgdir"/usr/share/webapps/homer \
		"$pkgdir"/var/log/homer \
		"$pkgdir"/usr/share/licenses/$pkgname
	mv "$srcdir"/dist/3rdpartylicenses.txt \
		"$pkgdir"/usr/share/licenses/$pkgname/3rdpartylicenses.txt
	mv "$srcdir"/dist "$pkgdir"/usr/share/webapps/homer
	install -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="40faf2d70d7c6a29fb447dee5f2a41aa7d5ea88a84c7205ff7d47f94f3df9fa96ecbff8586a0dd5a3ef1152bbe7d7decb8089eefab4091fcc84d1c70c6d892b2  homer-app-1.2.0.tar.gz
a05a9969f407d030ec908c47d47467699fc1a8baec151c9f9d3bc4094226cb20567178f1111987f84dd88953130ab2529bc7400cd861c0801285e204f652bb94  homer-ui-7.8.0.tgz
2ba4e0403bd6f3b08a3a4d8bf366ec776941b5a29e9728ca2aefbfc663ce64c01f67a2f8f408a777db7921f8f66f93797fb5f056809901d3f25fe39b414b5865  homer-app.initd
be531ea77a31ad3856f1f5783c671ff3bd3cad5fda43c06f6ef2b063bcb80f402011771f6ac5da73e164ee359b3ba1bb5e0f98dad1baa0c97676692ab646efe6  change-default-locations.patch"
